package org.bjf.modules.user.enums;

/**
 * 使用枚举有更高的可读性，在代码上约束常量泛滥
 *
 * @aurhor bjf on 2017/8/17.
 */
public enum RedisKey {
  ACCESS_TOKEN("live:erp:accessToken", "登录token"),
  SYS_RIGHT_ALL("live:erp:sys_right", "全部权限列表");

  private String name;
  private String desc;

  RedisKey(String name, String desc) {
    this.name = name;
    this.desc = desc;
  }

  public String as(Object... args) {
    StringBuilder sb = new StringBuilder(name);
    for (Object arg : args) {
      sb.append(":").append(arg.toString());
    }
    return sb.toString();
  }
}
